<%@page import="com.slayer.service.LMSBookLocalServiceUtil"%>
<%@page import="com.liferay.portal.kernel.util.ParamUtil"%>
<%@page import="com.slayer.model.impl.LMSBookImpl"%>
<%@page import="com.slayer.model.LMSBook"%>
<%@include file="/html/library/init.jsp" %>
<% 
PortletURL updateBookURL = renderResponse.createActionURL();
updateBookURL.setParameter(ActionRequest.ACTION_NAME, MyLibraryConstants.ACTION_UPDATE_BOOK);

LMSBook lmsBook = new LMSBookImpl();
long bookId = ParamUtil.getLong(request,"bookId");
if(bookId > 0l)
{
lmsBook = LMSBookLocalServiceUtil.fetchLMSBook(bookId);	
}	
%>
<h1>
Add/Edit form
</h1>
<aui:form name="fm" method="POST" action="<%=updateBookURL.toString()%>">
<aui:input name="bookId" type="hidden" value="<%=lmsBook.getBookId()%>"/>
<aui:input name="redirectUrl" type="hidden" value="<%= renderResponse.createRenderURL().toString()%>"></aui:input>
<aui:input name="bookTitle" lable="Book Title" value="<%=lmsBook.getBookTitle() %>"/>
<aui:input name="author" label="Author" value="<%=lmsBook.getAuthor()%>"/>
<aui:button type="submit" value="Save"/>
</aui:form>


<br/><a href="<portlet:renderURL/>">&laquo; Go Back </a>

<aui:script>
Liferay.Util.focusFormField(document.<portlet:namespace/>fm.<portlet:namespace/>bookTitle);
</aui:script>
